	$('#panelKategori').panel({
		width: frmWidth-227,
		height: frmHeight-91,
		title: 'Manajemen Kategori Artikel',
	});

	$('#gridKategori').datagrid({
		title:'',
		width: frmWidth-250,
		height:frmHeight-142,
		nowrap: true,
		autoRowHeight: false,
		striped: true,
		collapsible:false,
		url:host+'ctrlpnl/kategori/dataKategori',
		sortName: 'category_name',
		sortOrder: 'desc',
		remoteSort: false,
		idField:'',
		singleSelect: true, 
		pagination:true,
		rownumbers:true,
		onLoadSuccess: function(data){
				if(data.total == 0){
					var $panel = $(this).datagrid('getPanel');
					var $info = '<div class="info-empty">Data Kategori Kosong</div>';
					$($panel).find(".datagrid-view2 .datagrid-body").append($info);
					//$('#edit_data').linkbutton({disabled:true});
					//$('#delete_data').linkbutton({disabled:true});
				}
		},			
		columns:[[
			{field:'stateid' ,title:'Kode Kategori', width:200, hidden:true, align: 'left'},
			{field:'category_code' ,title:'Kode Kategori', width:200, sortable:true, align: 'left'},
			{field:'category_name' ,title:'Kategori', width:200, align: 'left'}
		]],
		toolbar:[
			{
				text:'Tambah',
				iconCls:'icon-add',
				handler:function(){
					$.post(host+'ctrlpnl/kategori/formdata/new','',function(resp){
						$("#kategori").fadeOut(500, function(){ $('#kategori').html(resp).fadeIn(800); })
					});
				}
			},'-',
			{
				text:'Edit',
				iconCls:'icon-edit',
				handler:function(){
					var row = $('#gridKategori').datagrid('getSelected');
					if(row){
						$.post(host+'ctrlpnl/kategori/formdata/edit',{ID:row.stateid},function(resp){
							$("#kategori").fadeOut(500, function(){ $('#kategori').html(resp).fadeIn(800); })
						});
					}else{
						alert('Pilih Data Yang Akan Di Edit!');
					}
				}
			},'-',
			{
				text:'Hapus',
				iconCls:'icon-remove',
				handler:function(){
				var row = $('#gridKategori').datagrid('getSelected');
					if(row){
						$.post(host+'ctrlpnl/kategori/deleteData',{'ID': row.stateid},function(resp){
							if(resp == 1){
								alert("Data Posting Telah Terhapus!");
								$('#gridKategori').datagrid('reload');
							}else{
								alert(resp);
							}
						})
					}else{
						alert('Pilih Data Yang Akan Di Hapus!');
					}
				}
			},'-',
							
		]
	});

	